package org.example.onlineEducation.controller;

import org.example.onlineEducation.entity.User;
import org.example.onlineEducation.service.LoginService;
import org.example.onlineEducation.service.UserService;
import org.example.onlineEducation.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;
    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    public Result login(@RequestBody User user){
        System.out.println(user);
        return loginService.login(user);
    }

    @RequestMapping("/test1")
    public Result test1(){

        return Result.success("这是已授权的测试接口");
    }

    @RequestMapping("/test2")
    public Result test2(){

        return Result.success("这是未授权的测试接口");
    }

}
